package com.drinks.yiniang.adapter.base;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.drinks.yiniang.R;
import com.drinks.yiniang.ui.widget.layout.CustomLoadMoreView;
import com.drinks.yiniang.ui.widget.recycler.BaseRecyclerView;

import java.util.List;

/**
 * recyclerview base adapter
 * <p>
 * Created by han on 2019/6/14 0014.
 */

public abstract class BaseQuickRCVAdapter<T, K extends BaseViewHolder> extends BaseQuickAdapter<T, K> {

    public BaseQuickRCVAdapter(@LayoutRes int layoutResId, @Nullable List<T> data) {
        super(layoutResId, data);

        setLoadMoreView(new CustomLoadMoreView());
    }

    public void setCenterEmpty(LayoutInflater inflater, BaseRecyclerView rcv) {
        if(inflater == null || rcv == null) {
            return;
        }
        setEmptyView(inflater.inflate(R.layout.layout_empty_center, (ViewGroup) rcv.getParent(), false));
    }

    public void setCommonEmpty(LayoutInflater inflater, BaseRecyclerView rcv) {
        if(inflater == null || rcv == null) {
            return;
        }
        setEmptyView(inflater.inflate(R.layout.layout_empty, (ViewGroup) rcv.getParent(), false));
    }
}
